package com.dhl.cloud.common.http;

import com.dhl.cloud.common.Constants;

public class HttpResult {

	private int code;
	private String msg;	
	private Page page;
	private Object data;

	private HttpResult(int code,String msg,Page page,Object data)
	{
		this.code = code;
		this.msg = msg;
		this.data = data;
		this.page = page;
	}
	
	public static HttpResult success(String msg)
	{
		return new HttpResult(Constants.CODE_10000,msg,null,null);
	}
	
	public static HttpResult success(Object data)
	{
		return new HttpResult(Constants.CODE_10000,"",null,data);
	}
	
	public static HttpResult success(String msg,Object data)
	{
		return new HttpResult(Constants.CODE_10000,msg,null,data);
	}
	
	public static HttpResult success(String msg,Page page,Object data)
	{
		return new HttpResult(Constants.CODE_10000,msg,page,data);
	}
	
	public static HttpResult error(String msg)
	{
		return new HttpResult(Constants.CODE_10004,msg,null,null);
	}
	
	public static HttpResult error(int errorcode,String msg)
	{
		return new HttpResult(errorcode,msg,null,null);
	}
	
	public static HttpResult error(int errorcode,String msg,Object obj)
	{
		return new HttpResult(errorcode,msg,null,obj);
	}
	
	public static HttpResult error(String msg,Object data)
	{
		return new HttpResult(Constants.CODE_10004,msg,null,data);
	}
	
	public Page getPage() {
		return page;
	}

	public void setPage(Page page) {
		this.page = page;
	}
	
	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

}
